40 RANDOMIZE:HOME
49 '''''INITIALIZE FOR MAIN PART OF GAME
50 DIM A$(55):Q8=8:P5=.15:PRINT:PRINT,"* * * STAR TREK * * *":PRINT:DIM Q$(64),G1$(126),D$(8),G(8,8),K(21,3),Z(8,8),D(8)
60 DEF FND(S)=SQR((K(I,1)-S1)^2+(K(I,2)-S2)^2):DEF FNR(S)=INT(RND(1)*S+1):DEF FNX(S)=INT(S*10+.5)/10:DEF FNM(T)=T-INT(T)
1200 T=(FNR(20)+19)*100:T0=T:E=3000:S=0:P=10:Q1=FNR(8):Q2=FNR(8):S1=FNR(8):S2=FNR(8)
1290 DATA Warp Engines,S.R.Sensors,L.R.Sensors,Phaser Cntrl,Photon Tubes,Damage Cntrl,Shield Cntrl,Computer
1300 FOR N=1 TO 8:READ D$(N):NEXT
1370 DATA Antares,Sirius,Regel,Deneb,Procyon,Capella,Vega,Betelgeuse,Canopus,Alderbaron,Altair,Regulus,Sagittarius,Arcturus,Pollux,Spica
1380 FOR N=1 TO 16:READ G1$(N):NEXT
1520 B9=0:K9=0:FOR I=1 TO 8:FOR J=1 TO 8:R1=RND(1)
1570 IF R1>.96 THEN 1610
1580 IF R1<.82 THEN 1640ELSE R1=INT((R1-.7)/.1)+1:GOTO 1620
1610 R1=INT(RND(1)*3)+1
1620 G(I,J)=INT(R1)*100:K9=K9+INT(R1)
1640 IF RND(1)<.95 THEN 1670ELSE B9=B9+1:G(I,J)=G(I,J)+10
1670 G(I,J)=G(I,J)+INT(RND(1)*8+1)+INT(RND(1)*1000)/1000:Z(I,J)=0:NEXT J,I:R1=INT(RND(1)*8+1):R2=INT(RND(1)*8+1):IF B9><0 THEN 1760ELSE G(R1,R2)=G(R1,R2)+10:B9=1
1760 IF G(R1,R2)>=200 THEN 1790ELSE G(R1,R2)=G(R1,R2)+100:K9=K9+1
1790 K7=K9:PRINT"Here are your orders:":PRINT"	Destroy the"K9"Klingon Warships which have invaded":PRINT"	the Galaxy before they can attack Federation Headquarters":A$="is":IF B9<>1 THEN A$="are"
1860 PRINT"	on Stardate"T0+30".  This gives you 30 days. There "A$:A$="s":IF B9=1 THEN A$=""
1900 PRINT"	"B9"Starbase"A$" in the Galaxy for resupplying your ship."
1910 PRINT:PRINT"Your mission begins with your Starship located":PRINT"in";:GOTO 2070
2059 '''''NEW QUADRANT
2060 PRINT"Now entering";
2070 GOSUB 2730:PRINT" the Galactic Quadrant "A$:R1=INT(G(Q1,Q2)):K3=INT(R1/100):B3=INT(R1/10)-10*K3:S3=R1-100*K3-10*B3:IF K3=0 THEN 2180
2140 PRINT"COMBAT area","Condition RED":IF S<201 THEN PRINT"	Shields DANGEROUSLY low"
2180 FOR I=1 TO 21:K(I,3)=0:NEXT I:Q$="":FOR I=1 TO 64:Q$(I)=" ":NEXT I
2259 '''''SET UP QUADRANT
2260 R1=S1*8+S2-8:Q$(R1)="#":A$="*":T1=G(Q1,Q2)-INT(G(Q1,Q2)):IF S3<>0 THEN FOR I=1 TO S3:GOSUB 3110:NEXT I
2330 IF B3<>0 THEN A$="!":GOSUB 3110:B1=R1:B2=R2
2380 A$="+":IF K3<>0 THEN FOR I=1 TO K3:GOSUB 3110:K(I,1)=R1:K(I,2)=R2:K(I,3)=200:NEXT I
2450 GOSUB 3430
2459 '''''COMMAND CONTROL
2460 IF S+E<10 THEN 8550ELSE IF E<=10 THEN IF D(7)<0 THEN 8550
2500 FOR I=1 TO 8:IF D(I)>0 THEN D(I)=0
2530 NEXT I
2540 PRINT"Command ";:INPUT A$
2560 IF A$="NAV"THEN 3960ELSE IF A$="SRS"THEN 2450ELSE IF A$="LRS"THEN 5850ELSE IF A$="PHA"THEN 6150ELSE IF A$="TOR"THEN 6570ELSE IF A$="SHE"THEN 5270ELSE IF A$="DAM"THEN 5550
2630 IF A$="XXX"THEN 8630ELSE IF A$="POS"THEN 8810ELSE IF A$="COM"THEN 7320ELSE IF A$="STR"THEN 8850ELSE IF A$="GAS"THEN 8700ELSE IF A$="DIS"THEN 8850
2690 PRINT"Legal commands are:":PRINT"NAV,SRS,LRS,PHA,TOR,SHE,DAM,COM,POS,GAS,XXX,STR,DIS":GOTO 2540
2729 '''''QUADRANT NAME
2730 R1=Q1:R2=Q2:GOSUB 2860:A$=G1$(L0):L1=R2-INT((R2-1)/4)*4:A$=A$+" ":IF L1<>4 THEN FOR L0=1 TO L1:A$=A$+"I":NEXT L0:RETURN
2840 A$=A$+"IV":RETURN
2860 L0=R1*2+INT((R2-1)/4)-1:RETURN
2879 '''''KLINGONS SHOOT BACK
2880 IF K3<=0 THEN RETURN ELSE IF D0=1 THEN 3090ELSE FOR I=1 TO 21:IF K(I,3)<=0 THEN 3060
2940 R2=INT((K(I,3)/FND(1)*(2+RND(1)))):PRINT R2"unit hit on Enterprise from sector "K(I,1)","K(I,2):S=S-R2:IF S<0 THEN 8290
2990 IF R2<=20 OR R2<=S/50 THEN 3060ELSE IF RND(1)>.6 THEN 3060
3030 T1=FNR(8):D(T1)=FNX(D(T1)-R2/S-.5*RND(1)):PRINT"Damage Control reports:",D$(T1)"	damaged by hit"
3060 NEXT I
3070 PRINT"(shields down to"S"units)":RETURN
3090 PRINT"Starbase shields protect Enterprise":RETURN
3109 '''''INSERT A RANDOM HOLE IN THE QUADRANT
3110 IF A$="+"THEN 3200ELSE R1=INT(T1*8+1):T1=FNM(T1*4041+.791):R2=INT(T1*8+1):T1=FNM(T1*4041+.791)
3180 L1=R1*8+R2-8:GOTO 3230
3200 R1=FNR(8):R2=FNR(8):GOTO 3180
3230 IF Q$(L1)<>" "THEN 3200ELSE Q$(L1)=A$:RETURN
3259 '''''PRINT A LINE OF SENSOR DATA
3260 IF Q2=1 OR Q2=5 THEN PRINT"|";
3270 FOR J=0 TO 7:L0=I+J:IF Q$(L0)<>" "THEN PRINT TAB(J*4+2);:N=INSTR("*+!#",Q$(L0)):PRINT MID$(" * ++K)#(O-E",N*3-2,3);
3400 NEXT J:I=I+8:IF Q2=4 OR Q2=8 THEN PRINT TAB(J*4+1)"|";
3420 RETURN
3429 '''''SENSOR SCAN
3430 FOR I=S1-1 TO S1+1:IF ABS(I-4.5)>4 THEN 3510
3460 FOR J=S2-1 TO S2+1:IF ABS(J-4.5)<4 THEN L1=I*8+J-8:IF Q$(L1)="!"THEN 3610
3500 NEXT J
3510 NEXT I:D0=0:A$="Green":IF E<300 THEN A$="Yellow"
3560 IF K3>0 THEN A$=CHR$(7)+"RED"+CHR$(7)
3580 IF D(2)>=0 THEN 3670ELSE PRINT"Short Range Sensors are out.":RETURN
3610 A$="Docked":D0=1:E=3000:P=10:S=0:PRINT"Shields dropped for dosking purposes"
3670 PRINT"+";:FOR I=1 TO 8:PRINT"---+";:NEXT I:PRINT:Z(Q1,Q2)=G(Q1,Q2):I=1:GOSUB 3260:PRINT:GOSUB 3260
3770 PRINT TAB(37)"Star Date",FNX(T):GOSUB 3260:PRINT TAB(37)"Condition"," "A$:GOSUB 3260:PRINT TAB(37)"Quadrant   ",Q1","Q2:GOSUB 3260:PRINT TAB(37)"Sector    ",S1","S2:GOSUB 3260
3850 PRINT TAB(37)"Total Energy",E+S:GOSUB 3260:PRINT TAB(37)"Photon Torpedos",P:GOSUB 3260:PRINT TAB(37)"Shields    ",S:PRINT"+";:FOR I=1 TO 8:PRINT"---+";:NEXT I:PRINT:RETURN
3959 '''''NAVIGATION CONTROL
3960 PRINT"Course (1-9) =",:INPUT C1:IF ABS(C1-5)>4 THEN 2460ELSE IF C1=9 THEN C1=1
4030 PRINT"Warp Factor (0-8) =",:INPUT W1:IF ABS(W1-4)>4 THEN PRINT"	Chief Engineer Scott reports, `The Engines won't take Warp"W1"`":GOTO 2460
4090 IF D(1)<0 AND W1>.2 THEN PRINT"Warp Engines damaged.  Maximum speed = Warp 0.2":GOTO 3960
4130 L=INT(W1*8+.5):IF E<L THEN PRINT"	Engineering reports, `Insufficent energy available":PRINT"	for manoeuvering at warp"W1"`":IF S<L-E THEN 2460ELSE IF D(7)>=0 THEN 5270ELSE 2460
4199 '''''KLINGONS MOVE/FIRE
4200 FOR I=1 TO 21:IF K(I,3)>0 THEN L1=K(I,1)*8+K(I,2)-8:Q$(L1)=" ":A$="+":GOSUB 3110:K(I,1)=R1:K(I,2)=R2
4289 '''''SOME RANDOM DAMAGE/IMPROVEMENT WITH TIME
4290 NEXT I:GOSUB 2880:D1=0:R1=FNR(8):FOR I=1 TO 8:R2=W1:IF W1>1 THEN R2=1
4380 IF I=R1 AND RND(1)<.3 THEN R2=R2+8*(RND(1)-.6)
4410 IF D(I)>=0 AND R2>=0 THEN 4590ELSE D(I)=FNX(D(I)+R2):IF R2>=0 AND D(I)<0 AND R2<1.1 THEN 4590
4470 IF D1=0 THEN PRINT"Damage Control report:":D1=1
4500 PRINT TAB(8),D$(I):IF R2<0 THEN PRINT"damaged"
4530 IF D(I)>=0 THEN PRINT"repair completed":D(I)=0:GOTO 4590
4570 IF R2>0 THEN PRINT"state of repair improved"
4590 NEXT I
4599 '''''MOVE SHIP
4600 T1=S1:T2=S2:L1=INT(S1)*8+INT(S2)-8:Q$(L1)=" ":C1=(C1-1)*.785398:R1=-SIN(C1):R2=COS(C1):FOR I=1 TO L:S1=S1+R1:S2=S2+R2:IF ABS(S1-4.5)>=4 OR ABS(S2-4.5)>=4 THEN 4950
4730 L1=INT(S1+.5)*8+INT(S2+.5)-8:IF Q$(L1)=" "THEN 4840
4750 IF Q$(L1)="*"THEN PRINT"You have just driven the Enterprise into a star!":PRINT"	The Enterprise has been vaporised!":GOTO 8290
4790 S1=INT(S1-R1+.5):S2=INT(S2-R2+.5):PRINT"Warp Engines shut down at sector"S1","S2"due":PRINT,"to bad navigation.":GOTO 4870
4840 NEXT I:S1=INT(S1+.5):S2=INT(S2+.5)
4870 L1=INT(S1)*8+INT(S2)-8:Q$(L1)="#":GOSUB 5450:T=T+1:IF W1<1 THEN T=T-1+INT(10*W1)/10
4930 IF T>T0+30 THEN 8430ELSE 2450
4950 R1=8*Q1+T1+L*R1:R2=8*Q2+T2+L*R2:T1=Q1:T2=Q2:Q1=INT((R1-1)/8):Q2=INT((R2-1)/8):S1=INT(R1-8*Q1):S2=INT(R2-8*Q2):IF ABS(Q1-4.5)>=4 THEN 5080
5040 IF ABS(Q2-4.5)<4 THEN 5210ELSE PRINT"	Lt.Uhuru reports message from starfleet command:":PRINT"	`Permission to attempt crossing of galactic perimeter":PRINT"	is hereby *denied*. Shut down your Engines.`"
5080 IF Q1<1 THEN Q1=1:S1=1
5110 IF Q2<1 THEN Q2=1:S2=1
5140 IF Q1>8 THEN Q1=8:S1=8
5170 IF Q2>8 THEN Q2=8:S2=8
5200 PRINT"Chief Engineer Scott reports, `Warp Engines shut down`"
5210 IF T>T0+30 THEN 8430
5220 IF Q1=T1 AND Q2=T2 THEN 4870
5240 T=T+1:GOSUB 5450:GOTO 2060
5269 '''''SHIELD CONTROL
5270 IF D(7)<0 THEN PRINT"Shield Control inoperative":GOTO 2460
5310 PRINT"Energy available ="E+S:PRINT" Number of units to shields = ";:INPUT R1:IF R1<0 THEN 2460ELSE IF R1=S THEN PRINT,"(shields unchanged)":GOTO 2460
5380 IF R1>E+S THEN 5310ELSE E=E+S-R1:S=R1:PRINT"	Deflector Control reports, `Shields now at"S:PRINT,"per your command.`":GOTO 2460
5440 GOTO 2060
5449 '''''ENERGY USED BY WARP ENGINES
5450 E=E-L-10:IF E<0 THEN 5500ELSE RETURN
5490 PRINT"Shield Control supplied energy to complete manoeuver."
5500 S=S+E:E=0
5520 IF S<0 THEN S=0
5540 RETURN
5549 '''''DAMAGE CONTROL REPORT
5550 IF D(6)>=0 THEN 5760ELSE PRINT"Damage Control report not available"
5580 IF D0=0 THEN 2460ELSE R1=0:FOR I=1 TO 8:IF D(I)<0 THEN R1=R1+.1-D(I)/100
5630 NEXT I:IF R1=0 THEN 2460ELSE IF R1>1 THEN R1=1
5670 PRINT"Technicians standing by to affect repairs to your ship.":PRINT"Estimated time to repair :"FNX(R1)"stardates.":PRINT"Will you authorize the repair order (YES/NO)  ":INPUT A$:
5710 IF A$<>"YES"THEN 2460ELSE FOR I=1 TO 8:D(I)=0:NEXT I:T=T+INT(R1*10+RND(1)+.5)/10
5760 PRINT:PRINT"Device"TAB(25)"State of Repair":FOR I=1 TO 8:PRINT D$(I);TAB(25);:IF D(I)<0 THEN PRINT"Damaged   "D(I)ELSE PRINT"Functional"
5830 NEXT I:GOTO 5580
5849 '''''LONG RANGE SENSORS
5850 PRINT"Long Range Sensor";:IF D(3)<0 THEN PRINT"s are inoperable.":GOTO 2460ELSE PRINT" scan for quadrant"Q1","Q2:A$="+":FOR I=1 TO 3:A$=A$+"-----+":NEXT I:PRINT A$
5960 FOR I=Q1-1 TO Q1+1:PRINT"|";:FOR J=Q2-1 TO Q2+1:R1=0:IF ABS(I-4.5)<=4 AND ABS(J-4.5)<=4 THEN R1=INT(G(I,J)):Z(I,J)=G(I,J)
6040 PRINT USING" ### |";R1;:NEXT J:PRINT:PRINT A$:NEXT I:PRINT:GOTO 2460
6149 '''''PHASER CONTROL
6150 IF K3<=0 THEN PRINT"	Science Officer Spock reports, `Sensors show":PRINT,"no enemy ships in this quadrant.`":GOTO 2460
6200 IF D(4)<0 THEN PRINT"Phasers inoperative":GOTO 2460ELSE IF D(8)<0 THEN PRINT"Computer failure hampers accuracy"
6250 PRINT"Phasers locked on target."
6260 PRINT"Energy available ="E:PRINT"Number of units to fire ";:INPUT R1:IF R1<=0 THEN 2460ELSE IF R1>E THEN 6260ELSE E=E-R1:GOSUB 2880:R1=INT(R1/K3)
6340 FOR I=1 TO 21:IF K(I,3)<=0 THEN 6550ELSE R2=INT(R1/FND(1)*(RND(1)+2)):IF D(7)<0 THEN R2=R2*(RND(1)*.6+.2)
6390 IF D(8)>0 THEN R2=R2*(.7+.2*RND(1))
6410 IF R2<=.15*K(I,3)THEN PRINT"Sensors show now damage to enemy at"K(I,1)","K(I,2):GOTO 6550ELSE K(I,3)=K(I,3)-R2:PRINT R2"unit hit on Klingon at sector"K(I,1)","K(I,2):IF K(I,3)>0 THEN 6550
6470 PRINT"*** Klingon destroyed ***":K3=K3-1:R2=K(I,1)*8+K(I,2)-8:Q$(R2)=" ":G(Q1,Q2)=G(Q1,Q2)-100:Z(Q1,Q2)=G(Q1,Q2):K9=K9-1:IF K9<=0 THEN 8360
6550 NEXT I:GOTO 2460
6569 '''''TORPEDO CONTROL
6570 IF D(5)>=0 AND P>0 THEN 6620
6600 PRINT"Photon tubes are not operational.":GOTO 2460
6620 PRINT"How many torpedos to fire ";:INPUT M8:IF M8>P THEN 6600ELSE FOR M9=1 TO M8:PRINT"Torpedo Course (1-9) =";:INPUT C1
6680 IF ABS(C1-5)>4 THEN PRINT"Ensign Chekov reports, `Incorrect course data, Sir!`":PRINT"Present launch anulled.":PRINT"Salvo launch continues on stardate "T:GOTO 6930
6730 IF C1>=9 THEN C1=1
6750 T1=S1:T2=S2:C1=(C1-1)*.7854:R1=-SIN(C1):R2=COS(C1):E=E-2:P=P-1:M3=0:PRINT"Torpedo track:"
6840 T1=T1+R1:T2=T2+R2:M3=M3+1:IF M3<10 THEN L0=INT(T1+.5):L1=INT(T2+.5):IF ABS(L0-4.5)<4 AND ABS(L1-4.5)<4 THEN 6960
6920 PRINT"Torpedo missed."
6930 NEXT M9:GOSUB 2880:GOTO 2460
6960 PRINT,L0","L1:L=L0*8+L1-8:IF Q$(L)="+"THEN 7200ELSE IF Q$(L)="!"THEN 7110ELSE IF Q$(L)="#"THEN 7070ELSE IF Q$(L)<>"*"THEN 6840
7020 IF RND(1)>.2 THEN C1=RND(1)*8+1:PRINT"torpedo has been deflected by the gravitational field of the":PRINT"star.  New torpedo course is = "C1:GOTO 6680
7070 PRINT"*** Enterprise destroyed ***":PRINT"	Your torpedo has destroyed you due to its change in course":PRINT"The Federation will be conquered!":GOTO 8320
7110 PRINT"*** Star Base destroyed ***":B9=B9-1:IF B9<=0 THEN 8490ELSE PRINT"Star Fleet Command reviewing your record to consider Court-Martial":D0=0:G(Q1,Q2)=G(Q1,Q2)-10
7170 Z(Q1,Q2)=G(Q1,Q2):Q$(L)=" ":GOTO 6930
7200 PRINT"*** KLINGON DESTROYED ***":K3=K3-1:K9=K9-1:IF K9<=0 THEN 8360ELSE FOR I=1 TO 21:IF K(I,3)>0 AND K(I,1)=L0 AND K(I,2)=L1 THEN 7290
7280 NEXT I
7290 K(I,3)=0:G(Q1,Q2)=G(Q1,Q2)-100:GOTO 7170
7320 IF D(8)<0 THEN PRINT"Computer disabled.":GOTO 2460
7360 PRINT"Computer active and awaiting command: ";:INPUT R1:IF R1<0 THEN 2460ELSE IF R1<>INT(R1)THEN 7360
7400 IF R1>5 THEN PRINT"Only functions 0 to 5 are legal":GOTO 7360
7430 ON R1+1 GOTO 7440,7770,7880,7950,8020,7470
7440 PRINT:PRINT"Computer Record of the Galaxy":PRINT:T1=0:GOTO 7490
7470 PRINT:PRINT,"The Galaxy":T1=1
7490 A$="     +":FOR R2=1 TO 8:PRINT TAB(6*R2+2);R2;:A$=A$+"-----+":NEXT R2:PRINT:PRINT A$:FOR R1=1 TO 8:PRINT R1"  |";:IF T1<>0 THEN FOR R2=1 TO 8 STEP 4:GOSUB 2860:PRINT TAB(6*R2+8);G1$(L0);:NEXT R2:GOTO 7730
7640 FOR R2=1 TO 8:IF INT(Z(R1,R2))<>0 THEN PRINT TAB(6*R2+1);:PRINT USING" ###";INT(Z(R1,R2));
7720 NEXT R2
7730 PRINT TAB(54);"|":PRINT A$:NEXT R1:GOTO 2460
7770 PRINT"Status report":PRINT K9"Klingon";:IF K9<>1 THEN PRINT"s";
7810 PRINT" left":PRINT"Mission must be completed in"T0+30-T"stardates":PRINT"The federation is maintaining"B9"Starbase";:IF B9<>1 THEN PRINT"s";
7880 PRINT:FOR I=1 TO 21:IF K(I,3)>0 THEN R1=K(I,1):R2=K(I,2):GOSUB 8130
7930 NEXT I:GOTO 2460
7950 IF B3=0 THEN PRINT"	Mr. Spock reports, `Sensors show no starbases in this quadrant":GOTO 2460ELSE R1=B1-S1:R2=B2-S2:GOSUB 8130:GOTO 2460
8020 PRINT"Direction/Distance Calculator":PRINT"	You are in quadrant"Q1","Q2" sector"S1","S2:PRINT"Quadrant  ";:INPUT T1,T2:PRINT"Sector    ";:INPUT R1,R2:R1=(Q1+S1/8)-T1-R1/8:R2=(Q2+S2/8)-T2-R2/8:GOSUB 8130:GOTO 2460
8130 L=SQR(R1*R1+R2*R2):PRINT"Distance ="L:IF L<.1 THEN 8280ELSE IF ABS(R2)<.1 THEN T1=5-2*SGN(R1)ELSE T1=3-2*SGN(R2)+ATN(R1/R2)*4/3.14159:IF T1<1 THEN T1=T1+8
8230 T1=INT((10-T1)*100+.5)/100:IF T1>=9 THEN T1=1
8270 PRINT,"Direction ="T1
8280 RETURN
8289 '''''ENTERPRISE DESTROYED
8290 PRINT"The Enterprise has been destroyed. The Federation will be":PRINT"conquered."
8320 PRINT"It is stardate"T:PRINT"There were"K9"Klingons left at the end of your mission.":PRINT:END
8359 '''''ALL KLINGONS DESTROYED
8360 PRINT:PRINT"Congratulations Captain. The last Klingon Battle Cruiser":PRINT"has been destroyed. The Federation is saved.":PRINT:PRINT"Your efficiency rating is "K7/(T-T0)*1000:STOP
8429 '''''TIME UP
8430 PRINT"Captain, I am afraid you are too old and slow to":PRINT"command a starship. You are hereby releaved of command.":PRINT"and put out to pasture..":PRINT:GOTO 8320
8489 '''''LAST STAR BASE DESTROYED
8490 PRINT"You have just destroyed your last starbase, and left":PRINT"yourself alone in the Galaxy. You are hereby releaved of":PRINT"your command, and ordered to report for Court-Martial.":PRINT:GOTO 8320
8549 '''''ENTERPRISE OUT OF ACTION
8550 PRINT"Captain, you have just stranded your ship in space!!!":PRINT"You have insufficient energy to manoeuver the ship, and":PRINT"Shield Control is presently incapable of cross-circuiting":PRINT"energy to the engine room"
8600 PRINT"The Federation is left at the mercy of the Klingons.":PRINT:GOTO 8320
8629 '''''RESIGNED COMMAND
8630 PRINT"Your Resignation is accepted with regret.":PRINT"	(Here Chooky Chook Chook !!!!!!!!!!)":PRINT:GOTO 8320
8700 FOR I=1 TO 8:FOR J=1 TO 8:Z(I,J)=G(I,J):NEXT J,I:PRINT"Mr. Sulu reports, `All Scouts reported Sir`":PRINT:PRINT"Mr. Spock reports,":PRINT"`All data correlated and stored in computer, Captain.`":GOTO 7440
8810 PRINT"Mr. Spock reports `Enterprise now in quadrant"Q1","Q2" sector"S1","S2"`":GOTO 2540
8850 PRINT"Course  ";:INPUT C1:IF A$="DIS"THEN Q8=1
8890 M3=C1:IF ABS(C1-5)>4 THEN PRINT"Mr. Sulu reports, `Incorrect course data, Sir`":GOTO 2460
8930 IF C1>=9 THEN C1=1
8950 T1=S1:T2=S2:C1=(C1-1)*.7854:R1=-SIN(C1):R2=COS(C1):E=E-1
9010 T1=T1+R1:T2=T2+R2:L0=INT(T1+.5):L1=INT(T2+.5):IF ABS(L0-4.5)>=4 OR ABS(L1-4.5)>=4 THEN 9150
9070 L=L0*8+L1-8:IF Q$(L)="!" AND Q8=1 THEN 9460ELSE IF Q$(L)="*"THEN IF Q8=1 THEN 9180ELSE 9120
9110 GOTO 9010
9120 PRINT"Mr. Spock reports,":PRINT"	`Sensors show there is a star on course"M3", Captain.`":GOTO 2460
9150 PRINT"Mr. Spock reports,":PRINT"	`Sensors show no stars in this quadrant on course"M3", Captain.`":GOTO 2460
9180 PRINT:PRINT:PRINT"Mr. Spock reports,":PRINT"	`Star disintigrator at work Captain.`":PRINT"Antimatter Pile increasing in temperature.":PRINT"	Disintegration temperature of the Pile is now becoming":PRINT"dangerously high.  Abort now ";
9250 INPUT A$:IF A$="YES"THEN 9440ELSE P5=P5+.025:IF RND(1)>=P5 THEN 9350
9290 PRINT"Your Antimatter Engines have exploded":PRINT"The Enterprise has been blown clean through":PRINT"	Hyperspace and no longer exists."
9320 PRINT"The Federation will be conquered":PRINT:GOTO 8320
9349 '''''STAR DISINTIGRATED
9350 PRINT"Star disintegrated, Captain.":PRINT"Antimatter Engines now cooling. Energy now at";:E=E-5:PRINT E:PRINT"The engines wont take too much of this Captain.":PRINT:Q$(L)=" ":G(Q1,Q2)=G(Q1,Q2)-1:Z(Q1,Q2)=G(Q1,Q2)
9440 Q8=0:GOTO 2540
9460 PRINT:PRINT"Sensors show there is a starbase on this course.":PRINT"Computer override command annuls energy production":PRINT"Computer says,":PRINT"`Only extra-ordinary circumstances permit destruction"
9510 PRINT"	of a starbase. Your authority is insufficient.":PRINT,"Phase-down of energy production completed.":PRINT:GOTO 2540
9550 END
                                                                                                                              